package com.zyh.domain;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @Author zyh
 * @Date 2024/8/23 17:08
 * @Description
 */

public class PageInfo<T> implements Serializable {
    @Serial
    private static final long serialVersionUID = 7411793641172189686L;
     List<T> pageData;
     Integer pageCount;

    public PageInfo() {
    }

    public PageInfo(List<T> pageData, Integer pageCount) {
        this.pageData = pageData;
        this.pageCount = pageCount;
    }

    public List<T> getPageData() {
        return pageData;
    }

    public void setPageData(List<T> pageData) {
        this.pageData = pageData;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }

    @Override
    public String toString() {
        return "PageInfo{" +
                "pageData=" + pageData +
                ", pageCount=" + pageCount +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PageInfo<?> pageInfo = (PageInfo<?>) o;

        if (pageData != null ? !pageData.equals(pageInfo.pageData) : pageInfo.pageData != null) return false;
        return pageCount != null ? pageCount.equals(pageInfo.pageCount) : pageInfo.pageCount == null;
    }

    @Override
    public int hashCode() {
        int result = pageData != null ? pageData.hashCode() : 0;
        result = 31 * result + (pageCount != null ? pageCount.hashCode() : 0);
        return result;
    }
}
